import "../css/RowFilter-CGvYI1Zn.css";
import { defineComponent as K, toRefs as j, openBlock as s, createElementBlock as m, createElementVNode as h, normalizeClass as z, unref as e, createVNode as l, withCtx as t, Fragment as S, renderList as B, ref as _, createBlock as O, createCommentVNode as Y, createTextVNode as g, onMounted as H } from "vue";
import { j as P, k as q, aX as Q, bO as W, bP as F, aY as L, e as Z, b as V, o as ee, P as le, g as te, r as ae, f as J } from "./vendor.CF2kwqqq.js";
import { _ as G } from "./_plugin-vue_export-helper.CHgC5LLL.js";
import { d as M, b as oe, e as ne } from "./index.Bbfhrq76.js";
const se = {
  class: "filter-logical",
  flex: "",
  "flex-col": "",
  "items-center": "",
  "justify-center": ""
}, ue = /* @__PURE__ */ K({
  __name: "logical",
  props: {
    modelValue: {
      type: String,
      default: "or"
    },
    isView: {
      type: Boolean,
      default: !1
    }
  },
  emits: ["update:modelValue"],
  setup(c, { emit: k }) {
    const b = c, x = k, { modelValue: a, isView: i } = j(b), d = [
      { label: "或", value: "or" },
      { label: "且", value: "and" }
    ], f = (n) => {
      x("update:modelValue", n);
    };
    return (n, C) => (s(), m("div", se, [
      h("div", {
        class: z(["logical-line", [e(a) == "or" ? "border-or" : "border-and"]])
      }, null, 2),
      h("div", {
        class: z(["logical-content", [e(a) == "or" ? "or" : "and"]])
      }, [
        l(e(P), {
          "model-value": e(a),
          disabled: e(i),
          onChange: f
        }, {
          default: t(() => [
            (s(), m(S, null, B(d, (u) => l(e(q), {
              label: u.label,
              value: u.value,
              key: u.value
            }, null, 8, ["label", "value"])), 64))
          ]),
          _: 1
        }, 8, ["model-value", "disabled"])
      ], 2)
    ]));
  }
}), re = /* @__PURE__ */ G(ue, [["__scopeId", "data-v-8e145c71"]]), ie = { class: "filter-wrap flex" }, de = { class: "filter-rules flex-1" }, pe = {
  key: 0,
  class: "filter-rule-item"
}, ce = { class: "rule-item-btns flex items-center" }, fe = { class: "flex flex-col items-start" }, ve = /* @__PURE__ */ K({
  __name: "filter",
  props: {
    condition: {},
    isView: { type: Boolean },
    inputValue: {}
  },
  emits: ["delAllNode"],
  setup(c, { expose: k, emit: b }) {
    const x = c, { condition: a, isView: i, inputValue: d } = j(x), f = b, n = _(), C = _({
      field: [{ required: !0, message: "字段不能为空", trigger: "change" }],
      compare: [{ required: !0, message: "规则不能为空", trigger: "change" }],
      value: [{ required: !0, message: "值不能为空", trigger: "blur" }]
    }), u = [
      { label: "等于", value: "==" },
      { label: "不等于", value: "!=" },
      { label: "模糊匹配	", value: "like" },
      { label: "包含", value: "in" },
      { label: "不包含	", value: "notin" },
      { label: "大于", value: ">" },
      { label: "小于", value: "<" },
      { label: "大于等于", value: ">=" },
      { label: "小于等于", value: "<=" }
      // { label: "属于区间", value: "between" },
    ], $ = _(!1), T = () => {
      $.value = !0;
    }, w = () => {
      $.value = !1;
    }, R = () => ({
      field: "",
      compare: "",
      value: ""
    }), N = () => ({
      operator: "or",
      subCondition: [R()]
    }), E = (p = []) => {
      p.push(R()), w();
    }, U = (p = []) => {
      p.push(N()), w();
    }, y = (p = [], v) => {
      p.splice(v, 1), p.length == 0 && f("delAllNode");
    }, A = _(), D = _(!0);
    return k({
      validateEvent: async () => {
        D.value = !0;
        try {
          if (A.value && A.value.length > 0)
            for (const p of A.value)
              await p.validateEvent() || (D.value = !1);
          await n.value.validate();
        } catch {
          D.value = !1;
        }
        return D.value;
      }
    }), (p, v) => (s(), m("div", ie, [
      l(re, {
        class: "logical-container",
        modelValue: e(a).operator,
        "onUpdate:modelValue": v[0] || (v[0] = (r) => e(a).operator = r),
        isView: e(i)
      }, null, 8, ["modelValue", "isView"]),
      h("div", de, [
        l(e(Q), {
          ref_key: "formRef",
          ref: n,
          model: e(a)
        }, {
          default: t(() => [
            (s(!0), m(S, null, B(e(a).subCondition, (r, I) => (s(), m("div", { key: I }, [
              r.subCondition ? (s(), O(X, {
                key: 1,
                ref_for: !0,
                ref_key: "filterRef",
                ref: A,
                condition: r,
                "input-value": e(d),
                isView: !1,
                onDelAllNode: (o) => y(e(a).subCondition, I)
              }, null, 8, ["condition", "input-value", "onDelAllNode"])) : (s(), m("div", pe, [
                l(e(W), { gutter: 10 }, {
                  default: t(() => [
                    l(e(F), { span: 8 }, {
                      default: t(() => [
                        l(e(L), {
                          prop: `subCondition.${I}.field`,
                          rules: C.value.field
                        }, {
                          default: t(() => [
                            l(e(P), {
                              "popper-class": "select_popper",
                              modelValue: r.field,
                              "onUpdate:modelValue": (o) => r.field = o,
                              placeholder: "请选择",
                              clearable: "",
                              disabled: e(i)
                            }, {
                              default: t(() => [
                                (s(!0), m(S, null, B(e(d), (o) => (s(), O(e(q), {
                                  label: o.name,
                                  value: o.name,
                                  key: o.name
                                }, null, 8, ["label", "value"]))), 128))
                              ]),
                              _: 2
                            }, 1032, ["modelValue", "onUpdate:modelValue", "disabled"])
                          ]),
                          _: 2
                        }, 1032, ["prop", "rules"])
                      ]),
                      _: 2
                    }, 1024),
                    l(e(F), { span: 6 }, {
                      default: t(() => [
                        l(e(L), {
                          prop: `subCondition.${I}.compare`,
                          rules: C.value.compare
                        }, {
                          default: t(() => [
                            l(e(P), {
                              "popper-class": "select_popper",
                              modelValue: r.compare,
                              "onUpdate:modelValue": (o) => r.compare = o,
                              placeholder: "请选择",
                              clearable: "",
                              disabled: e(i)
                            }, {
                              default: t(() => [
                                (s(), m(S, null, B(u, (o) => l(e(q), {
                                  label: o.label,
                                  value: o.value,
                                  key: o.value
                                }, null, 8, ["label", "value"])), 64))
                              ]),
                              _: 2
                            }, 1032, ["modelValue", "onUpdate:modelValue", "disabled"])
                          ]),
                          _: 2
                        }, 1032, ["prop", "rules"])
                      ]),
                      _: 2
                    }, 1024),
                    l(e(F), { span: 8 }, {
                      default: t(() => [
                        l(e(L), {
                          prop: `subCondition.${I}.value`,
                          rules: C.value.value
                        }, {
                          default: t(() => [
                            l(e(Z), {
                              modelValue: r.value,
                              "onUpdate:modelValue": (o) => r.value = o,
                              placeholder: "请输入，多个值请用,隔开",
                              disabled: e(i)
                            }, null, 8, ["modelValue", "onUpdate:modelValue", "disabled"])
                          ]),
                          _: 2
                        }, 1032, ["prop", "rules"])
                      ]),
                      _: 2
                    }, 1024),
                    l(e(F), { span: 2 }, {
                      default: t(() => [
                        h("div", ce, [
                          e(i) ? Y("", !0) : (s(), O(e(V), {
                            key: 0,
                            link: "",
                            icon: e(ee),
                            style: { height: "32px" },
                            onClick: (o) => y(e(a).subCondition, I)
                          }, null, 8, ["icon", "onClick"]))
                        ])
                      ]),
                      _: 2
                    }, 1024)
                  ]),
                  _: 2
                }, 1024)
              ]))
            ]))), 128))
          ]),
          _: 1
        }, 8, ["model"]),
        l(e(le), {
          "popper-class": "select_popper",
          visible: $.value,
          trigger: "click"
        }, {
          reference: t(() => [
            l(e(V), {
              type: "primary",
              class: "btn-add",
              onClick: T
            }, {
              default: t(() => [
                g(" 添加 ")
              ]),
              _: 1
            })
          ]),
          default: t(() => [
            h("div", fe, [
              l(e(V), {
                link: "",
                onClick: v[1] || (v[1] = (r) => E(e(a).subCondition))
              }, {
                default: t(() => [
                  g(" 条件 ")
                ]),
                _: 1
              }),
              l(e(V), {
                link: "",
                style: { "margin-left": "0" },
                onClick: v[2] || (v[2] = (r) => U(e(a).subCondition))
              }, {
                default: t(() => [
                  g(" 条件组 ")
                ]),
                _: 1
              })
            ])
          ]),
          _: 1
        }, 8, ["visible"])
      ])
    ]));
  }
}), X = /* @__PURE__ */ G(ve, [["__scopeId", "data-v-6079ee36"]]), me = { class: "nifi-filter" }, _e = {
  class: "filter_content",
  "h-468": ""
}, be = { class: "filter_footer" }, ge = /* @__PURE__ */ K({
  __name: "index",
  props: {
    formdata: {},
    propInput: {},
    propOutput: {},
    inputV: {}
  },
  setup(c) {
    const k = c, { formdata: b, inputV: x, propInput: a, propOutput: i } = j(k), d = _(!1), f = () => {
      d.value = !0;
    }, n = () => {
      d.value = !1;
    }, C = _(x.value), u = _({}), $ = () => {
      u.value = {};
    }, T = () => {
      u.value = {
        operator: "or",
        isTop: !0,
        // 最外层
        subCondition: [
          {
            field: "",
            compare: "",
            value: ""
          }
        ]
      };
    }, w = _(), R = async () => {
      w.value ? await w.value.validateEvent() && (N(), n()) : (N(), n());
    }, N = () => {
      J(b.value, i.value, M(C.value)), J(b.value, a.value, M(u.value));
    };
    return H(() => {
      let E = te(b.value, a.value);
      E && (u.value = JSON.parse(E)), N();
    }), (E, U) => (s(), m("div", me, [
      g(" 行过滤配置: "),
      l(e(V), {
        type: "primary",
        onClick: f,
        style: { "margin-left": "12px" }
      }, {
        default: t(() => [
          g(" 行过滤配置 ")
        ]),
        _: 1
      }),
      l(e(ae), {
        modelValue: d.value,
        "onUpdate:modelValue": U[0] || (U[0] = (y) => d.value = y),
        title: "行过滤配置",
        "destroy-on-close": "",
        "h-642": "",
        "before-close": n
      }, {
        default: t(() => {
          var y;
          return [
            h("div", _e, [
              (y = u.value) != null && y.isTop ? (s(), O(X, {
                key: 0,
                ref_key: "filterRef",
                ref: w,
                condition: u.value,
                "input-value": C.value,
                "is-view": !1,
                onDelAllNode: $
              }, null, 8, ["condition", "input-value"])) : (s(), O(e(V), {
                key: 1,
                onClick: T
              }, {
                default: t(() => [
                  g(" 添加 ")
                ]),
                _: 1
              }))
            ]),
            h("div", be, [
              l(e(V), { onClick: n }, {
                default: t(() => [
                  g("取消")
                ]),
                _: 1
              }),
              l(e(V), {
                type: "primary",
                onClick: R
              }, {
                default: t(() => [
                  g("保存")
                ]),
                _: 1
              })
            ])
          ];
        }),
        _: 1
      }, 8, ["modelValue"])
    ]));
  }
}), Ve = /* @__PURE__ */ G(ge, [["__scopeId", "data-v-a87cf31a"]]), Ee = () => {
  let c = [];
  const k = ["output-param", "output字段（自动填入）"];
  return { name: ["org.apache.nifi.column.processors.RowFilter_1_0"], excludeKeys: ["expression", "output-param"], selfFormColumn: [
    {
      tag: Ve,
      propInput: "config.properties['expression']",
      propOutput: "config.properties['output-param']",
      ":formdata": "formData",
      setup() {
        return { inputV: c };
      },
      ":inputV": "inputV"
    }
  ], hooksOpen: (f, n) => {
    c = [], c = oe(f, n, k);
  }, hooksSubmit: (f, n) => {
    ne(f, n);
  } };
};
export {
  Ee as default
};
